<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <title>登录</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="__PACKAGE__/layui/css/layui.css">
    <link rel="stylesheet" href="__PACKAGE__/layuiadmin/style/login.css">

    <style>
        body {
            position: fixed;
            width: 100%;
            height: 100%;
            background: url("{$background}") center center no-repeat,
            rgb(102, 102, 102);
            background-size: cover;
            -moz-background-size: cover;
            -webkit-background-size: cover;
            -o-background-size: cover;
        }

        .layadmin-user-login-main {
            background: rgb(255 255 255 / 70%);
        }
    </style>
</head>

<body>
    <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
        <div class="layadmin-user-login-main">
            <div class="layadmin-user-login-box layadmin-user-login-header">
                <h2>HSK99</h2>
                <p>管理系统</p>
            </div>
            <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
                <div class="layui-form-item">
                    <label class="layadmin-user-login-icon layui-icon layui-icon-username"
                        for="LAY-user-login-username"></label>
                    <input type="text" name="username" id="LAY-user-login-username" lay-verify="required"
                        lay-verType="tips" lay-reqText="请输入用户名" placeholder="用户名" class="layui-input">
                </div>

                <div class="layui-form-item">
                    <label class="layadmin-user-login-icon layui-icon layui-icon-password"
                        for="LAY-user-login-password"></label>
                    <input type="password" name="password" id="LAY-user-login-password" lay-verify="required"
                        lay-verType="tips" lay-reqText="请输入密码" placeholder="密码" class="layui-input">
                </div>

                <div class="layui-form-item">
                    <div class="layui-row">
                        <div class="layui-col-xs6">
                            <label class="layadmin-user-login-icon layui-icon layui-icon-vercode"
                                for="LAY-user-login-vercode"></label>
                            <input type="text" name="captcha" id="LAY-user-login-captcha" lay-verify="required"
                                lay-verType="tips" lay-reqText="请输入验证码" placeholder="验证码" class="layui-input">
                        </div>
                        <div class="layui-col-xs6">
                            <div style="margin-left: 10px;">
                                <img src="{:url('captcha')}" alt="点击更换" title="点击更换"
                                    onclick="this.src='{:url(\'captcha\')}?time='+Math.random()"
                                    class="captcha layadmin-user-login-codeimg" id="LAY-user-get-vercode">
                            </div>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <button class="layui-btn layui-btn-fluid submit" lay-submit lay-filter="LAY-user-login-submit">登
                        入</button>
                </div>
            </div>
        </div>
    </div>
</body>

</html>
<script src="__JS__/jquery.min.js"></script>
<script src="__PACKAGE__/layui/layui.js"></script>
<script type="text/javascript">
    var layer = layui.layer,
        form = layui.form;

    $("body").keydown(function () {
        if (event.keyCode == '13') {
            $(".submit").click();
        }
    });

    form.on('submit(LAY-user-login-submit)', function (obj) {
        $.ajax({
            type: "post",
            url: "{:url('do_login')}",
            data: obj.field,
            dataType: "json",
            success: function (response) {
                layer.msg(response.msg, {
                    icon: response.code == 200 ? 1 : 2,
                    time: 1500
                }, function () {
                    if (response.code == 200) location.href = response.data.url;
                });
            }
        });
    });
</script>